﻿<%@ Page Language="C#" Theme="Default" MasterPageFile="~/MasterPages/admin.master" AutoEventWireup="true"  CodeFile="UserAccountEdit.aspx.cs" Inherits="UserAccountEdit" Title="UserAccount Edit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">User Account - Add/Edit</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
		<data:MultiFormView ID="FormView1" DataKeyNames="Id" runat="server" DataSourceID="UserAccountDataSource">
		
			<EditItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/UserAccountFields.ascx" />
			</EditItemTemplatePaths>
		
			<InsertItemTemplatePaths>
				<data:TemplatePath Path="~/Admin/UserControls/UserAccountFields.ascx" />
			</InsertItemTemplatePaths>
		
			<EmptyDataTemplate>
				<b>UserAccount not found!</b>
			</EmptyDataTemplate>
			
			<FooterTemplate>
				<asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
				<asp:Button ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
				<asp:Button ID="CancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
			</FooterTemplate>

		</data:MultiFormView>
		
		<data:UserAccountDataSource ID="UserAccountDataSource" runat="server"
			SelectMethod="GetById"
		>
			<Parameters>
				<asp:QueryStringParameter Name="Id" QueryStringField="Id" Type="String" />

			</Parameters>
		</data:UserAccountDataSource>
		
		<br />

		<asp:Panel ID="ActivityPanel2" runat="server" CssClass="collapsePanelHeader"> 
			<div style="padding:5px; cursor: pointer; vertical-align: middle;">
				<div style="float: left; vertical-align: middle;"><asp:Image ID="ActivityImage" runat="server" ImageUrl="~/images/expand_blue.jpg"/></div>
				<div style="float: left; padding-left: 5px;">Activity Details</div>
				<div style="float: left; margin-left: 20px;"><asp:Label ID="ActivityLabel" runat="server" /></div>
			</div>
		</asp:Panel>	
		<asp:Panel ID="ActivityPanel1" runat="server" CssClass="collapsePanel" Height="0">
		<data:EntityGridView ID="GridViewActivity1" runat="server"
			AutoGenerateColumns="False"	
			OnSelectedIndexChanged="GridViewActivity1_SelectedIndexChanged"			 			 
			DataSourceID="ActivityDataSource1"
			DataKeyNames="Id"
			AllowMultiColumnSorting="false"
			DefaultSortColumnName="" 
			DefaultSortDirection="Ascending"	
			ExcelExportFileName="Export_Activity.xls"  		
			Visible='<%# (FormView1.DefaultMode == FormViewMode.Insert) ? false : true %>'	
			>
			<Columns>
				<asp:CommandField ShowSelectButton="True" />
				<asp:BoundField DataField="SessionId" HeaderText="Session Id" SortExpression="[SessionId]" />				
				<data:HyperLinkField HeaderText="User Id" DataNavigateUrlFormatString="UserAccountEdit.aspx?Id={0}" DataNavigateUrlFields="Id" DataContainer="UserIdSource" DataTextField="Username" />
				<asp:BoundField DataField="Ip" HeaderText="Ip" SortExpression="[Ip]" />				
				<asp:BoundField DataField="DateLogin" HeaderText="Date Login" SortExpression="[DateLogin]" />				
				<asp:BoundField DataField="DateLogout" HeaderText="Date Logout" SortExpression="[DateLogout]" />				
				<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="[Description]" />				
			</Columns>
			<EmptyDataTemplate>
				<b>No Activity Found! </b>
				<asp:HyperLink runat="server" ID="hypActivity" NavigateUrl="~/admin/ActivityEdit.aspx">Add New</asp:HyperLink>
			</EmptyDataTemplate>
		</data:EntityGridView>					
		
		<data:ActivityDataSource ID="ActivityDataSource1" runat="server" SelectMethod="Find"
			EnableDeepLoad="True"
			>
			<DeepLoadProperties Method="IncludeChildren" Recursive="False">
	            <Types>
					<data:ActivityProperty Name="UserAccount"/> 
				</Types>
			</DeepLoadProperties>
			
		    <Parameters>
				<data:SqlParameter Name="Parameters">
					<Filters>
						<data:ActivityFilter  Column="UserId" QueryStringField="Id" /> 
					</Filters>
				</data:SqlParameter>
				<data:CustomParameter Name="OrderByClause" Value="" ConvertEmptyStringToNull="false" /> 
		    </Parameters>
		</data:ActivityDataSource>		
		
		<br />
		</asp:Panel>
		
<ajaxToolkit:CollapsiblePanelExtender ID="cpeActivity" runat="Server" TargetControlID="ActivityPanel1"
            ExpandControlID="ActivityPanel2" CollapseControlID="ActivityPanel2" Collapsed="True"
            TextLabelID="ActivityLabel" ExpandedText="(Hide Details...)" CollapsedText="(Show Details...)"
            ImageControlID="ActivityImage" ExpandedImage="~/images/collapse_blue.jpg" CollapsedImage="~/images/expand_blue.jpg"
            SuppressPostBack="true"/>


</asp:Content>

